package remote;

import java.io.Serializable;
import java.rmi.RemoteException;
import java.sql.*;

@SuppressWarnings("serial")
public class SimpleResultSet extends ResultSetAdapter implements Serializable{
   private RemoteResultSet rrs;
   
   public SimpleResultSet(RemoteResultSet s) {
	   System.out.println("Call SimpleRS <init>");
      rrs = s;
   }
   
   public boolean next() throws SQLException {
      try {
         return rrs.next();
      }
      catch (RemoteException e) {
         throw new SQLException(e);
      }
   }
   
   public void beforeFirst() throws SQLException {
	   try {
		   rrs.beforeFirst();
	   } catch (RemoteException e) {
		   throw new SQLException(e);
	   }
   }
   
   public Object getObject(int columnIndex) throws SQLException {
	   try {
		   return rrs.getObject(columnIndex);
	   } catch(RemoteException e) {
		   throw new SQLException(e);
	   }
   }
   
   public ResultSetMetaData getMetaData() throws SQLException {
      try {
         RemoteMetaData rmd = rrs.getMetaData();
         return new SimpleMetaData(rmd);
      }
      catch (RemoteException e) {
         throw new SQLException(e);
      }
   }
   
   public void close() throws SQLException {
      try {
         rrs.close();
      }
      catch (RemoteException e) {
         throw new SQLException(e);
      }
   }
}


